package com.util.view.toast;

import android.app.AlertDialog;
import android.content.Context;
import android.view.Window;

import com.util.R;

public class MyAlertDialog {
    public static  AlertDialog ShowDialog(Context context, int res) {
        AlertDialog ad = new AlertDialog.Builder(context, R.style.dialog).create();
        ad.setCancelable(false);
        ad.show();
        // 关键在下面的两行,使用window.setContentView,替换整个对话框窗口的布局
        Window window = ad.getWindow();
        window.setContentView(res);
        return ad;
    }
}
